# Contributor: Hoang Nguyen <folliekazetani@protonmail.com>
# Contributor: vinnie <fz12345@gmail.com>
# Maintainer: vinnie <fz12345@gmail.com>
pkgname=xonsh
pkgver=0.14.3
pkgrel=0
pkgdesc="Python-powered, cross-platform, Unix-gazing shell"
url="https://xon.sh"
arch="noarch"
license="BSD-2-Clause"
depends="
	py3-distro
	py3-prompt_toolkit>=3.0
	py3-pygments>=2.2
	py3-pyperclip
	py3-ujson
	"
makedepends="py3-setuptools py3-gpep517 py3-installer py3-wheel"
# man-db with groff-1.23.0 breaks "test_man.py" due to escape codes in output
checkdepends="
	mandoc
	util-linux-misc
	py3-pip
	py3-pyte
	py3-pytest
	py3-pytest-mock
	py3-pytest-rerunfailures
	py3-pytest-subprocess
	py3-pytest-timeout
	py3-virtualenv
	"
subpackages="$pkgname-pyc"
source="$pkgname-$pkgver.tar.gz::https://github.com/xonsh/xonsh/archive/$pkgver.tar.gz"

build() {
	gpep517 build-wheel \
		--wheel-dir .dist \
		--output-fd 3 3>&1 >&2
}

check() {
	python3 -m venv --clear --without-pip --system-site-packages .testenv
	.testenv/bin/python3 -m installer .dist/*.whl
	.testenv/bin/python3 -m pytest \
		--ignore=tests/test_integrations.py \
		--ignore=tests/test_pipelines.py \
		--ignore=tests/test_ptk_shell.py \
		--ignore=tests/completers/test_bash_completer.py \
		--ignore=tests/procs/test_specs.py
}

package() {
	python3 -m installer -d "$pkgdir" \
		.dist/*.whl

	# The build process appends dirty bit into the version string
	# if a git repo is detected
	sed -i "s/^\(__version__ =\).*/\1 \"$pkgver\"/" \
		"$pkgdir"/usr/lib/python*/site-packages/xonsh/__init__.py
}

sha512sums="
171ba29d992c8c2da37f3e790841a9041778af7e9e118b238caa36888a0845ce4785544c34ae7b993b2c8ac362f1fcdf4c65da01358ed21f820e9f25cf5a8aeb  xonsh-0.14.3.tar.gz
"
